import React, { Component } from 'react'
import { StyleSheet, View, Text, ActivityIndicator } from 'react-native'
import { connect } from 'react-redux'

import { Button, Touchable } from '../../components'

import { createAction, NavigationActions } from '../../utils'
import LoginPage from './Login'

const styles = StyleSheet.create({
  container: {
    flex: 1
  }
})

@connect(({ app, login, signUp }) => ({ ...app, login, signUp }))
class Login extends Component {
  render() {
    const { fetching } = this.props

    return (
      <View style={styles.container}>
        {fetching ? (
          <ActivityIndicator />
        ) : (
          <LoginPage {...this.props} />
        )}
      </View>
    )
  }
}


export default Login
